package com.jk.vehicle.mini.entity;

import com.jk.vehicle.core.entity.BaseEntity;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.*;
import lombok.Data;

@Table(name = "mileage_statistics_day")
@Data
public class MileageStatisticsDay extends BaseEntity {
    /**
     * 里程数
     */
    private BigDecimal mileage;

    /**
     * 总骑行时间（秒）
     */
    @Column(name = "ride_time")
    private Long rideTime;

    /**
     * 平均速度km/h
     */
    @Column(name = "avg_speed")
    private BigDecimal avgSpeed;

    /**
     * 最高速度
     */
    @Column(name = "top_speed")
    private BigDecimal topSpeed;

    /**
     * 其他统计数据，json格式
     */
    @Column(name = "other_data")
    private String otherData;

    /**
     * 统计时间
     */
    @Column(name = "record_day")
    private Date recordDay;

    /**
     * 车辆id
     */
    @Column(name = "bicycle_id")
    private Long bicycleId;

    /**
     * 开始时间
     */
    @Column(name = "create_date")
    private Date createDate;

    /**
     * 更新时间
     */
    @Column(name = "update_date")
    private Date updateDate;

    public static final class MileageStatisticsDayBuilder {
        private BigDecimal mileage;
        private Long rideTime;
        private Long id;
        private Byte delFlag = 0;
        private BigDecimal avgSpeed;
        private BigDecimal topSpeed;
        private String otherData;
        private Date recordDay;
        private Long bicycleId;
        private Date createDate;
        private Date updateDate;

        private MileageStatisticsDayBuilder() {
        }

        public static MileageStatisticsDayBuilder aMileageStatisticsDay() {
            return new MileageStatisticsDayBuilder();
        }

        public MileageStatisticsDayBuilder withMileage(BigDecimal mileage) {
            this.mileage = mileage;
            return this;
        }

        public MileageStatisticsDayBuilder withRideTime(Long rideTime) {
            this.rideTime = rideTime;
            return this;
        }

        public MileageStatisticsDayBuilder withId(Long id) {
            this.id = id;
            return this;
        }

        public MileageStatisticsDayBuilder withDelFlag(Byte delFlag) {
            this.delFlag = delFlag;
            return this;
        }

        public MileageStatisticsDayBuilder withAvgSpeed(BigDecimal avgSpeed) {
            this.avgSpeed = avgSpeed;
            return this;
        }

        public MileageStatisticsDayBuilder withTopSpeed(BigDecimal topSpeed) {
            this.topSpeed = topSpeed;
            return this;
        }

        public MileageStatisticsDayBuilder withOtherData(String otherData) {
            this.otherData = otherData;
            return this;
        }

        public MileageStatisticsDayBuilder withRecordDay(Date recordDay) {
            this.recordDay = recordDay;
            return this;
        }

        public MileageStatisticsDayBuilder withBicycleId(Long bicycleId) {
            this.bicycleId = bicycleId;
            return this;
        }

        public MileageStatisticsDayBuilder withCreateDate(Date createDate) {
            this.createDate = createDate;
            return this;
        }

        public MileageStatisticsDayBuilder withUpdateDate(Date updateDate) {
            this.updateDate = updateDate;
            return this;
        }

        public MileageStatisticsDay build() {
            MileageStatisticsDay mileageStatisticsDay = new MileageStatisticsDay();
            mileageStatisticsDay.setMileage(mileage);
            mileageStatisticsDay.setRideTime(rideTime);
            mileageStatisticsDay.setId(id);
            mileageStatisticsDay.setDelFlag(delFlag);
            mileageStatisticsDay.setAvgSpeed(avgSpeed);
            mileageStatisticsDay.setTopSpeed(topSpeed);
            mileageStatisticsDay.setOtherData(otherData);
            mileageStatisticsDay.setRecordDay(recordDay);
            mileageStatisticsDay.setBicycleId(bicycleId);
            mileageStatisticsDay.setCreateDate(createDate);
            mileageStatisticsDay.setUpdateDate(updateDate);
            return mileageStatisticsDay;
        }
    }
}